<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - 光年(Light Year Admin)后台管理系统模板</title>
<script type="text/javascript"
	src="${APP_PATH }/public/js/jquery.min.js"></script>
<script type="text/javascript"
	src="${APP_PATH }/public/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="${APP_PATH }/public/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${APP_PATH }/public/js/main.min.js"></script>
<script src="${APP_PATH }/public/layer/layer.js"></script>
<link rel="icon" href="${APP_PATH }/public/favicon.ico" type="image/ico">
<link href="${APP_PATH }/public/css/bootstrap.min.css" rel="stylesheet">
<link href="${APP_PATH }/public/css/materialdesignicons.min.css"
	rel="stylesheet">
<link href="${APP_PATH }/public/css/style.min.css" rel="stylesheet">
</head>

<body>
	<div class="lyear-layout-web">
		<div class="lyear-layout-container">
			<!--左侧导航-->
			<jsp:include page="${APP_PATH }/head.jsp"></jsp:include>
			<!--End 左侧导航-->
			<jsp:include page="${APP_PATH }/menu.jsp"></jsp:include>


			<!--页面主要内容-->
			<main class="lyear-layout-content">

				<div class="container-fluid">

					<div class="row">
						<div class="col-lg-12">
							<div class="card">
								<div class="card-toolbar clearfix">
									<form class="pull-right search-bar" method="get" action="#!"
										role="form">
										<div class="input-group">
											<input type="text" class="form-control has-success"
												name="info" id="info" type="text" placeholder="请输入姓名/学号">
										</div>
										<button type="button" class="btn btn-warning" id="btnSelect">
											<i class="glyphicon glyphicon-search"></i> 查询
										</button>
									</form>
								</div>
								<div class="card-body">

									<div class="table-responsive">
										<form id="sendall">
											<table class="table table-bordered">
												<thead>
													<tr>
														<th><label class="lyear-checkbox checkbox-primary">
																<input type="checkbox" id="check-all"><span></span>
														</label></th>

														<th>编号</th>
														<th>学号</th>
														<th>姓名</th>
														<th>班级</th>
														<th>邮箱</th>
														<th>电话</th>
														<th>性别</th>
														<th>出生日期</th>
														<th>所在城市</th>
														<th>结果</th>
														<th>填写面试结果</th>
													</tr>
												</thead>
												<tbody id="tbody">

												</tbody>
											</table>
										</form>
									</div>
									<ul class="pagination" id="byPage">

									</ul>

								</div>
							</div>
						</div>

					</div>

				</div>

			</main>
			<!--End 页面主要内容-->
		</div>
	</div>
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">面试结果</h4>
				</div>
					<div class="modal-body">
						<textarea id="comments" name="comments"
							style="width: 500px; height: 150px;"></textarea>
						<div class="col-lg-6">
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
								data-dismiss="modal">关闭</button>
							<button type="button" class="btn btn-primary" id="Uid" onclick="save()">点击保存</button>
						</div>

					</div>
			</div>
		</div>
	</div>


	<script type="text/javascript">
		$(document)
				.ready(
						function() {
							$('.search-bar .dropdown-menu a')
									.click(
											function() {
												var field = $(this).data(
														'field')
														|| '';
												$('#search-field').val(field);
												$('#search-btn')
														.html(
																$(this).text()
																		+ ' <span class="caret"></span>');
											});
							});
							show(1);
							$("#btnSelect").click(function() {
								show(1);
						});
		function show(pageNum) {
			var info = $("#info").val();
			$
					.ajax({
						url : "${APP_PATH}/company/addandinvite",
						type : "post",
						data : {
							"pageNum" : pageNum,
							"info" : info
						},
						success : function(obj) {
							if (obj.result) {
								var message = "";
								$
										.each(
												obj.everinviteList,
												function(index, everinvite) {
													message += '<tr>';
													message += '<label class="lyear-checkbox checkbox-primary">';
													message += "<td><input type='checkbox' name='uid' value='"+everinvite.uid+"'></td>";
													message += '</label>';
													message += '</td>';
													message += '<td>'
															+ (index + 1)
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.sno
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.uname
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.classid
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.ueamail
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.uphone
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.gender
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.birthdate
															+ '</td>';
													message += '<td>'
															+ everinvite.studentUser.city
															+ '</td>';
													message += '<td>'
															+ everinvite.result
															+ '</td>';
													message += '<td>';
													message += '<div class="btn-group">';
													message += '<button type="button" onclick=giveC('+everinvite.uid+') class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">面试结果</button>';
													message += '</div>';
													message += '</td>';
													message += '</tr>';
												});
								$("#tbody").html(message);
								var pageMessage = "";
								pageMessage += '<li class="'
										+ (obj.pageInfo.pageNum == 1 ? "disabled"
												: "") + '"><a onclick="show('
										+ obj.pageInfo.prePage
										+ ')">上一页</a></li>';
								for (var i = 1; i <= obj.pageInfo.pages; i++) {
									pageMessage += '<li class="'
											+ (obj.pageInfo.pageNum == i ? "active"
													: "")
											+ '"><a onclick="show('
											+ i
											+ ')">'
											+ i
											+ ' <span class="sr-only">(current)</span></a></li>';
								}
								pageMessage += '<li class="'
										+ (obj.pageInfo.pageNum == obj.pageInfo.pages ? "disabled"
												: "")
										+ '"><a onclick="show('
										+ obj.pageInfo.nextPage
										+ ')">下一页</a></li>';
								$("#byPage").html(pageMessage);
							}
						}
					});
		}
		function save() {
					var comments=$("#comments").val();
					var studentid=$("#Uid").val();
			$.ajax({
				url : "${APP_PATH}/company/pass?studentid="+studentid+"&comments="+comments,
				type : "post",
				data : $("#passForm").serialize(),
				success : function(obj) {
					if (obj.result) {
						layer.msg("提交成功", {
							time : 1000,
							icon : 6,
							shift : 6
						}, function() {
							<!--window.location.href = "${APP_PATH}/company/everinviteindex";-->
						});
					} else {
						layer.msg("提交失败", {
							time : 1000,
							icon : 5,
							shift : 6
						}, function() {
						});
					}
				}
			})

		}
		function giveC(uid){
			$("#Uid").val(uid);
		}
	</script>
</body>
</html>